Get Minimum and Maximum price of current category from product collection
<?php
namespace Letsknowit\Priceslider\Block;
use Magento\Catalog\Model\Layer\Filter\Price;
use Magento\Catalog\Model\Layer\Filter\FilterInterface;
use Magento\Framework\View\Element\Template;
use Magento\LayeredNavigation\Block\Navigation\FilterRendererInterface;
class FilterRenderer extends \Magento\LayeredNavigation\Block\Navigation\FilterRenderer {
protected $registry;
protected $request;
protected $productCollection;
protected $scopeConfig;
public function __construct(
\Magento\Framework\Registry $registry,
\Magento\Framework\App\RequestInterface $request,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection,
\Magento\Backend\Block\Template\Context $context,
array $data = [ ]
) {
$this->registry = $registry;
$this->request = $request;
$this->scopeConfig = $scopeConfig;
$this->productCollection = $productCollection;
parent::__construct($context, $data);
}
public function getPriceRange($filter) {
$category = $this->registry->registry('current_category');
$ProductFactory = $this->productCollection->addAttributeToSelect('price')->setOrder('price', 'DESC')->addCategoryFilter($category);
$maxPrice = $ProductFactory->getMaxPrice();
$minPrice = $ProductFactory->getMinPrice();
$filterprice = array('min' => $minPrice, 'max' => $maxPrice);
return $filterprice;
}
?>
G9BET is the leading reputable online bookmaker today that is worth experiencing. The playground is legally licensed from international organizations around the world. - please click here Readmore: trang chủ g9bet
alo789 is the leading reputable bookmaker brand in Asia that any online betting enthusiast in the market knows. THA Casino is a trusted and familiar "home" address of the betting community in countries in the region, including Vietnam. - please click here Readmore: https://alo789.boats/
Win79 always appears in the list of the most attractive entertainment game portals in Vietnam. Joining this playground, you can freely explore many interesting bets. In addition, you can also receive many other memorable experiences. Readmore: trang chủ win79
THABET is the leading reputable bookmaker brand in Asia that any online betting enthusiast in the market knows. THA Casino is a trusted and familiar "home" address of the betting community in countries in the region, including Vietnam. - please click here Readmore: đăng ký thabet
Helo88 (also known as Hello 88) is a bookmaker that is making waves in the online gaming community and those who love online betting. helo88 is not simply a bookmaker, but also a miniature entertainment world. With a series of interesting and exciting betting entertainment games. Readmore: tải app helo88
bj88 is known as one of the newest and most reputable bookmakers in 2024 in Asia. Website bj88 will share all necessary information for those who need it. This is bj88's latest homepage - please click here Readmore: bj88
Coming to 24N means you are entering the world of professionalism and class that a leading European bookmaker brings. Enjoy the world of quality, reputable online betting that few markets can provide. - please click here Readmore: nạp tiền 24n
bj38 is known as one of the newest and most reputable bookmakers in 2024 in Asia. Website bj38 will share all necessary information for those who need it. This is bj38's latest homepage - please click here Readmore: đăng ký bj38
bj38 is known as one of the newest and most reputable bookmakers in 2024 in Asia. Website bj38 will share all necessary information for those who need it. This is bj38's latest homepage - please click here Readmore: rút tiền bj38
The i9bet website will answer the questions asked in the above article. There are articles in this that make better sense. Please click this link for more details Readmore: i9bet.giving
Sv388 is a famous brand for providing online cockfighting matches. Here, players will enjoy super classic cockfighting matches of famous cock fighters famous around the world. - please click here Readmore: thomo hôm nay
The betting playground is gradually becoming more vibrant than ever with a series of bookmakers from all over. Here, hb88 bookmaker emerged as a central game hall that was warmly received by players across the country. Click here to go to the website Readmore: nhà cái hb88
The online game betting market is becoming more vibrant than ever with a series of bookmakers being introduced to Vietnam. In which, i9bet stands out with its new way of operating the game, attracting a large number of supporters from bettors everywhere. Today we introduce i9bet - the most popular bookmaker today. Readmore: nạp tiền i9bet
bj38 is known as one of the newest and most reputable bookmakers in 2024 in Asia. Website bj38 will share all necessary information for those who need it. This is bj38's latest homepage - please click here Readmore: trang chủ bj38
8kbet is known as one of the leading bookmakers in Asia. Operating from 2018 until now. The 8kbet website has attracted nearly 1,000,000 member registrations. Therefore, 8Kbet provides a lot of useful information for those who need it. This is the latest homepage of 8kbet - please click here Readmore: 8kbet
Please rotate your device
We don't support landscape mode on your device. Please rotate to portrait mode for the best view of our site